package fr.ordre66.vlcs.client;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;

import javax.swing.JPanel;

public final class ImagePane extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8348979568978370980L;

	private final BufferedImage image;

	private final Font font = new Font("Sansserif", Font.BOLD, 36);
	
	private String msg = "Ready";

	public ImagePane(BufferedImage image) {
		this.image = image;
	}

	@Override
	public void paint(Graphics g) {
		Graphics2D g2 = (Graphics2D) g;
		g2.drawImage(image, null, 0, 0);
		// You could draw on top of the image here...
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
				RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
		g2.setColor(Color.red);
		g2.setComposite(AlphaComposite.SrcOver.derive(0.3f));
		g2.fillRoundRect(50, 50, 30, 30, 32, 32);
		g2.setComposite(AlphaComposite.SrcOver);
		g2.setColor(Color.white);
		g2.setFont(font);
		g2.drawString(msg, 50, 50);
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	
}